<!DOCTYPE html>
<html>
<head>
<title>用户登录_login_</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=no" />-->
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet"  type="text/css" href="../kitchensink/android.css" title="synergy"/>
<link rel="stylesheet"  type="text/css" href="../kitchensink/android_480_login.css" title="synergy"/>

<script src="js/jquery.js"   charset="utf-8"></script>
<script type="text/javascript" charset="utf-8" src="../jq.mobi.js"></script>
<script>
	
var preventDefaultScroll = function(event) {
	event.preventDefault();
	window.scroll(0,0);
	return false;
};
	document.addEventListener('touchmove', preventDefaultScroll, false);
	
	$.ui={
		availableTransitions:{},
		css3animate: function(el, opts) {
		el = jq(el);
		if (!el.__proto__["css3Animate"])
			throw "css3Animate plugin is required";
		return el.css3Animate(opts);
   },
  /**
   * This must be called at the end of every transition to hide the old div and reset the doingTransition variable
   *
   * @param {Object} Div that transitioned out
   * @title $.ui.finishTransition(oldDiv)
   */
  finishTransition: function(oldDiv) {
	  
	  oldDiv.style.display = 'none';
	  this.doingTransition = false;
  
  },
  loadContent: function(target, newTab, back, transition, anchor){
	if(target.indexOf("#") == -1){
				
	}
  },
  loadContentFromTo: function(from, to, transition, anchor){
		if (from.indexOf("#") == -1) {
					
			}
		var from = document.getElementById(from);
			var to = document.getElementById(to);					
			this.availableTransitions[transition](from,to,true);	
	}	
	};	
</script>
<script type="text/javascript" charset="utf-8" src="../plugins/jq.css3animate.js"></script> 	
<script type="text/javascript" charset="utf-8" src="../transitions/all.js"></script>
</head> 
<body>
<!-- login page start -->

	
  <div id="main">
  	<header class="headerbar boxcontainer">
      <a href="#" id="exitIcon"><div class="item icon_back"></div></a>
      <div class="item flex"><h1>登录</h1></div>
      <a href="#" id="settingIcon"><div class="item icon_set"></div></a>
  	</header>
  	<div id="content">
  		<div class="center">
  			<span class="login_logo"></span>	
  		</div>
  		<div class="center">  
        <table class="table_form">
        <tr>
        	<td width="30%"><label for="userName"  >用户名:</label></td>
            <td><input  name="userName" type="text" id="userName" class="hs_ui_forms"></td>
 		</tr>
        <tr>
        <td>
        <label for="password"  >密 &nbsp;&nbsp;&nbsp;码:</label></td>
        <td><input name="password"   value="" id="password" type="password" class="hs_ui_forms"/></td>			        </tr>    
        <tr><td colspan="2" style="text-align:center">
        	<div>
	            <div style="display:inline">记住密码</div>
	            <div class="login_slider">
	            	<image id="isSaveSlider" class="slider" src="images/h/slider.png"/>
	            	<input type="radio" class="hidden" name="isSave" value="1"/>
                   <!-- <label class="inp_slider"></label>-->
	            </div>
          	</div>
            </td>
         </tr> 
            <tr><td colspan="2" style="text-align:center"><button type="button" class="hs_ui_forms">登录</button>
            <input type="hidden"  name="mac" id="mac" />
            <input type="hidden"  name="token" id="token" /></td></tr> 
          </table> 
           <br/>
           <br/>
           <br/>
           <br/>
           <br/>
           
		</div>				
  	</div>
  	 
  </div>
<!-- login page end -->

<!-- setting page start -->
<div id="setting" class="hidden">
    <header class="headerbar boxcontainer">
      <a href="#" id="backIcon"><div class="item icon_back"></div></a>
      <div class="item flex"><h1>全局设置</h1></div>
  	</header>
 
    <div id="content" class="center">
    	<ul id="ul_cache">
        <li><button onclick="clearWebCache()" class="hs_ui_forms" type="button" >缓存清除</button></li>
        <li><button onclick="checkUpgrade()"  class="hs_ui_forms" type="button" style="width:150px;">版本更新检查</button></li>
      </ul>
    </div>
</div>
<!-- setting page end -->



  <script type="text/javascript" charset="utf-8" src="../plugins/jq.extend.js?asdfsadf"></script>
 <script>
 	
 		var mawCss3animate = function($jq,_x,_y,_callback){
			$jq.css3Animate({
				x: _x,
				y: _y,
				time: "300ms",
				callback: function () {
					if(_callback)
						_callback();
				}	
			});	
		}
	 
 	$(document).ready(function(){
 		$("#userName").bind("focus",function(){
 			$(this).addClass("inp_login_active");	
 		}).bind("blur",function(){
 			$(this).removeClass("inp_login_active");	
 		});
 		
 		$("#password").bind("focus",function(){
 			$(this).addClass("inp_login_active");	
 		}).bind("blur",function(){
 			$(this).removeClass("inp_login_active");	
 		});
 		$("#exitIcon").bind("click",function(e){
 			GPlugin.exit([]);
 			//e.preventDefaultEvent();	
 		});
 		$("#settingIcon").bind("click",function(e){
 			$.ui.loadContentFromTo("main","setting","slide");
 			//e.preventDefaultEvent();	
 		});
 		$("#backIcon").bind("click",function(e){
 			$.ui.loadContentFromTo("setting","main","slide");
 			//e.preventDefaultEvent();	
 		});
 		
 		
 		
 		$(".slider").each(function(){
 			var sliderFlag = false; 
 			var _check = $(this).next().attr("value");	
 			if(_check == 1){
				_x = -29;
				mawCss3animate(jq(this),_x,0);
			}
 			
 			
 			$(this).bind("click",function(){
 				var _radio = $(this).next();
 				var _check = _radio.attr("value");	
 		 
 				var _x =0;
 				if(_check == 1){
 					_x = 0;
 				}else{
 					_x = -29;	
 				}
 				mawCss3animate(jq(this),_x,0,function(){
 					if(_check == 0){
 						_radio.attr("value",1);
 					 
 					}else{
 						_radio.attr("value",0);
 					 
 					}	
 				});
 					
 			});
 		 
 		});
 		
 		
 	});
 
  
 </script>

 
	<script>
 
 	  
		function resetLoginForm(){
			$("#userName").val("");	
			$("#password").val("");
			$("#isSave").val('0').slider("refresh");
		} 
		 
			 
		$("#visible").bind("click",function(){
 				
				if($(this).prop("checked")){
					$("#password").prop("type","text");
				}else{
					$("#password").prop("type","password");	
				}
			});
			
			 
			/** 
 			loadScript("/demo/js/util.js",function(){
				
				
				var token = getQueryString("token");
				if(token){
					$('#token').val(token);	
				}
				$("#loginPage").bind("pageshow",function(event,ui){
					resetLoginForm();
					readUserInfoFromFS();	
				});	
				
				document.removeEventListener("menubutton");	
				
			});
			**/ 
		 	
		 	
		 	
			$(document).ready(function(e) {
				$("#submit").bind("click",function(e){
					var userName = $('#userName').val();
					var password = $('#password').val();
					var isSave = 0;
					/*
					if($('#isSave').prop("checked")){
						isSave = 1;
					} 
					*/
					if($('#isSave').val() =='1'){
						isSave = 1;	
					}
					
					/*alert("userName: "+ userName+"  password: "+ password+"  token: "+token+"  imei: "+imei+"  imsi: "+imsi);*/
					
					
					if(userName ===""){
						Tool.alert("用户名不能为空!");
						return false;	
					}
					if(password ===""){
						Tool.alert("密码不能为空!");
						return false;	
					}
					GPlugin.storageUserKey([userName]);
					
					if(isSave == 1){
						MUser.saveUser(userName,password,isSave);	
					}
				 
					window.location.replace("portal.html");
			
	      });
					
			}); 
			
		 
		 
	</script>
	</body>
</html>
